package ru.dadle8;

//import util.properties packages

import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.clients.producer.Producer;
import org.apache.kafka.clients.producer.ProducerRecord;

public class SampleProducer extends AbstractProducer {

    @Override
    public void sendMessages(String topicName) {
        Producer<String, String> producer = new KafkaProducer<>(getProperties());
        for (int i = 0; i < 10; i++) {
            producer.send(new ProducerRecord<>(topicName, Integer.toString(i), Integer.toString(i)));
        }

        System.out.println("Message sent successfully");
        producer.close();
    }
}
